# -*- coding: utf-8 -*- 
# @Time : 2020-11-29 22:39 
# @Author : derek.zhang 
# @File : fake_app.py 
# @Software: PyCharm
from random import choice

from django.contrib.auth.models import User,Group

from appinput.models import App


def  fake_data():
    App.objects.all().delete()
    print('delete all app data')
    user_set = User.objects.all()
    app_list = ['ABC-FRONT-APP-ADMIN',
                'ABC-FRONT-APP-NGINX',
                'ABC-FRONT-APP-VUEJS',
                'ABC-FRONT-APP-ANGULAR',
                'ABC-FRONT-APP-BOOTSTRAP',
                'ABC-BACKEND-NODEJS',
                'ABC-BACKEND-JAVA',
                'ABC-BACKEND-GO',
                'ABC-BACKEND-PYTHON',
                'ZEP-BACKEND-SCALA',
                'ZEP-FROMT-APP-SCALA',
                'ZEP-FRONT-APP-NGINX',
                'ZEP-FRONT-APP-VUEJS',
                'ZEP-FRONT-APP-ANGULAR',
                'ZEP-FRONT-APP-BOOTSTRAP',
                'ZEP-BACKEND-NODEJS',
                'ZEP-BACKEND-JAVA',
                'ZEP-BACKEND-GO',
                'ZEP-BACKEND-PYTHON',
                ]


    for app_item in app_list:
        App.objects.create(name=app_item, jenkins_job=app_item,
                           git_url = 'http://localhost',
                           package_name = app_item + '.zip',
                           manage_user = choice(user_set))
    print('create all app data')